package com.xjm.utils;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.resource.ClassPathResource;
import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;

import java.util.HashMap;
import java.util.Map;

public class AdminContext {
    private static final ThreadLocal<Integer> adminId = new ThreadLocal<>();

    public static void setAdminId(Integer id) {
        adminId.set(id);
    }

    public static Integer getAdminId() {
        return adminId.get();
    }

    public static void removeAdminId() {
        adminId.remove();
    }

    public static void clear() {
        removeAdminId();
    }

    public static void main(String[] args) {
//        String host = "https://gyytz.market.alicloudapi.com";
//        String path = "/sms/smsSend";
//        String appcode = "22076213991f462882970fb0b703a7f7";
//        Map<String, String> headers = new HashMap<>();
//        headers.put("Authorization", "APPCODE " + appcode);
//        Map<String, String> querys = new HashMap<>();
//        querys.put("mobile", "17781841687");
//        querys.put("param", "**code**:12345,**minute**:5");
//
//        querys.put("smsSignId", "2e65b1bb3d054466b82f0c9d125465e2");
//        querys.put("templateId", "908e94ccf08b4476ba6c876d13f084ad");
//        System.out.println(HttpUtil.createPost(host + path + "?" + HttpUtil.toParams(querys)).addHeaders(headers)
//                .execute().body());
    }

}
